Implementing IAP to upgrade APP has no problem with this function, but you want to migrate the relatively fixed function in the APP to the bootloader, thereby reducing the APP space code and reducing the upgrade time. The APP invokes the function interface exported by the bootloader to implement the function call. Code examples Export the following interface to the APP in the bootloader Int exp_forapp_A(void) { Int k = 5; Return k; } Int exp_forapp_B(void) { Int k = 2; Unsigned char *p = malloc(100); If(p) { k = 5 Free(p); p = NULL; } Return k; } The code in the APP calls the above function Call exp_forapp_A function to get the correct return value 5 Call exp_forapp_B function, you can only get the return value 2 After debugging and analyzing, because exp_forapp_B calls malloc, the malloc inside the bootloader is used. At this time, because the ram space has been re-partitioned after jumping to app, malloc directly fails and returns NULL. Therefore, try to use malloc function in app to bootloader and use exp_forapp_B Int exp_forapp_B(void) { Int k = 2; Unsigned char *p = app_malloc(100); If(p) { k = 5 Free(p); p = NULL; } Return k; } At this point, it is found that p is actually assigned to the address beginning with 0x00, rather than the address after 0x20000000. After that, learning in QQ is definitely not wrong. Then through debugging the code, it is found that a global variable originally existed in the Bootloader has not been remapped, and will be used when calling. In turn, this leads to the problem of strange addresses in dynamically allocated memory. In summary, the original idea is correct. After the bootloader's dynamic memory allocation function malloc fails, the app's dynamic memory allocation function can be used to solve the problem that the exported function cannot use the function due to memory failure. Special attention should be paid to the issue of remapping global variables in the bootloader, otherwise an exception will occur. Pharmaceuticals,2-Methyl- Propanoic Acid Monohydrate Price,2-Methyl- Propanoic Acid Monohydrate Free Sample,Pure 2-Methyl- Propanoic Acid Monohydrate Zhejiang Wild Wind Pharmaceutical Co., Ltd. , https://www.wild-windchem.com